﻿@model dynamic
@{
    Layout = "../Shared/_Layout.cshtml";

    /*
     *  LAYOUT USAGE: this layout is for the dialog views using knockout js. The knockout js view model must have the appropriate properties:
     *  - success()
     *  - msgText()
     */

    /* REQUIRED VIEWBAG PARAMS in child view:
    ViewBag.Title = 
    ViewBag.Action = 
    ViewBag.ControllerId =
    */

}
@section Head {
    @RenderSection("Head", false)
}
<div id="editor" class="panel">
    <div class="boxhead">
        <h2>
            @ViewBag.Title</h2>
    </div>
    <div class="boxbody">        
        @using (Html.BeginForm((string)ViewBag.Action, (Guid)ViewBag.ControllerId))
        {
            @Html.UmbValidationSummary("Please correct the errors and try again.")
            
            @Html.UmbEditorBar()
                        
            <div id="editorContent" class="has-editor-bar padded-content scrolling-content" >
                <div class="narrow-editor">
                    <div data-bind="visible: !success()">
                        @RenderBody()
                    </div>
                    @if (IsSectionDefined("Notice"))
                    {
                        @RenderSection("Notice")
                    }
                    else
                    {
                        <div class="success" data-bind="text: msgText, visible: success()">
                        </div>
                    }                    
                </div>
            </div>
        }
    </div>
    <div class="boxfooter">
        <div class="statusBar">
            <h5>
            </h5>
        </div>
    </div>
</div>

<script type="text/javascript">
    //this places the cursor on the first available input that is not a button
    (function ($) {
        $("form:first").focusFirst();
    })(jQuery);
</script>